package multilwjgl;

import static org.lwjgl.opengl.GL11.GL_TRIANGLES;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glColor3f;
import static org.lwjgl.opengl.GL11.glEnd;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glVertex2f;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JFrame;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;

public class test {
	public static void main(String args[])
	{
		
		
		System.loadLibrary("jawt");
		System.loadLibrary("multilwjgl");
		
		multiglcanvas mgl = new multiglcanvas();
		
		JFrame fr = new JFrame();
		
		fr.setLayout(new BorderLayout());
		fr.add(mgl);
		fr.setSize(640, 480);
		fr.setBackground(Color.RED);
		fr.setVisible(true);
	
		
		mgl.setIgnoreRepaint(true);
		
		
		
	mgl.initgl(32, 0, 0, 0);
		
	mgl.currentize(true);
	
	try {
		GLContext.useContext(mgl);
	} catch (LWJGLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	float rot=0;
	while(true)
	{
		
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
		
		  glPushMatrix();
		  
		  GL11.glRotatef(rot, 0, 0, rot);
		  glBegin( GL_TRIANGLES );
		  glColor3f(1.0f, 0.0f, 0.0f);
		  glVertex2f(0.0f, 1.0f);
		  glColor3f(0.0f, 1.0f, 0.0f);
		  glVertex2f(0.87f, -0.5f);
		  glColor3f(0.0f, 0.0f, 1.0f);
		  glVertex2f(-0.87f, -0.5f);
		  glEnd();
		  glPopMatrix();
		mgl.swap();
		
			// TODO Auto-generated catch block
	rot+=.1f;
	}
	}
}
